package com.hqq.exercise.array;

import java.util.Scanner;

/**
 * CompareRecycle 循环数比较
 * 定义repeat(x1,k1) 表示把x1重复k1
 * 比如repeat(1010,2) == > 10101010
 * 要求输入x1,k1,x2,k2,比较repeat(x1,k1)和repeat(x2,k2)的大小
 * 样例输入:
 * 1010 3
 * 101010 2
 * 样例输出:
 * Equal
 * Created by heqianqian on 2017/9/11
 */
public class CompareRecycle {

    private static void compareRecyNum(long x1, long k1, long x2, long k2) {
        String v1 = repeat(x1, k1);
        String v2 = repeat(x2, k2);
        //根据长度判断
        if (v1.length()>v2.length()){
            System.out.println("Greater");
            return;
        }else if (v1.length()<v2.length()){
            System.out.println("Less");
            return;
        }else {
            for (int i = 0; i < v1.length(); i++) {
                if (v1.charAt(i)>v2.charAt(i)){
                    System.out.println("Greater");
                    return;
                }else if (v1.charAt(i)<v2.charAt(i)){
                    System.out.println("Less");
                   return;
                }
            }
        }
        System.out.println("Equal");
    }

    private static String repeat(long x1, long k1) {
        StringBuilder result = new StringBuilder(String.valueOf(x1));
        for (int i = 0; i < k1 - 1; i++) {
            result.append(x1);
        }
        return result.toString();//long类型不够存储
    }


    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long x1 = scanner.nextInt();
        long k1 = scanner.nextInt();
        long x2 = scanner.nextInt();
        long k2 = scanner.nextInt();
        compareRecyNum(x1, k1, x2, k2);
    }
}
